package app.vendorportal;

import core.framework.task.TaskExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.inject.Inject;

@Configuration
public class AppConfig {
    @Inject
    Environment env;

    @Bean
    public TaskExecutor taskExecutor() {
        return TaskExecutor.fixedSizeExecutor(25);
    }

//    @Bean
//    public FileManager fileManager() {
//        Assert.notNull(env.getRequiredProperty("file.upload.mode", FileUploadMode.class));
//        if (FileUploadMode.S3.equals(env.getRequiredProperty("file.upload.mode", FileUploadMode.class))) {
//            Assert.hasText(env.getRequiredProperty("s3.access.key"));
//            Assert.hasText(env.getRequiredProperty("s3.secret.key"));
//            Assert.hasText(env.getRequiredProperty("s3.bucket.name"));
//            return new AwsFileManager(env.getRequiredProperty("s3.access.key"), env.getRequiredProperty("s3.secret.key"), env.getRequiredProperty("s3.bucket.name"));
//        }
//        if (FileUploadMode.LOCALDISK.equals(env.getRequiredProperty("file.upload.mode", FileUploadMode.class))) {
//            Assert.notNull(env.getRequiredProperty("file.upload.path"));
//            return new LocalFileManager(env.getRequiredProperty("file.upload.path"));
//        }
//        throw new IllegalStateException("not supported file upload mode, provider=" + env.getRequiredProperty("file.upload.mode", FileUploadMode.class));
//    }
}
